package com.Endurancer.manager.service.impl;

import java.util.Collections;
import java.util.List;
import com.Endurancer.common.utils.DateUtils;
import com.Endurancer.manager.domain.vo.ThemesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.Endurancer.manager.mapper.BlogThemesMapper;
import com.Endurancer.manager.domain.BlogThemes;
import com.Endurancer.manager.service.IBlogThemesService;

/**
 * 博客主题Service业务层处理
 *
 * @author Endurancer
 * @date 2025-02-02
 */
@Service
public class BlogThemesServiceImpl implements IBlogThemesService
{
    @Autowired
    private BlogThemesMapper blogThemesMapper;

    /**
     * 查询博客主题
     *
     * @param themeId 博客主题主键
     * @return 博客主题
     */
    @Override
    public BlogThemes selectBlogThemesByThemeId(Long themeId)
    {
        return blogThemesMapper.selectBlogThemesByThemeId(themeId);
    }

    /**
     * 查询博客主题列表
     *
     * @param blogThemes 博客主题
     * @return 博客主题
     */
    @Override
    public List<BlogThemes> selectBlogThemesList(BlogThemes blogThemes)
    {
        return blogThemesMapper.selectBlogThemesList(blogThemes);
    }

    /**
     * 新增博客主题
     *
     * @param blogThemes 博客主题
     * @return 结果
     */
    @Override
    public int insertBlogThemes(BlogThemes blogThemes)
    {
        blogThemes.setCreateTime(DateUtils.getNowDate());
        return blogThemesMapper.insertBlogThemes(blogThemes);
    }

    /**
     * 修改博客主题
     *
     * @param blogThemes 博客主题
     * @return 结果
     */
    @Override
    public int updateBlogThemes(BlogThemes blogThemes)
    {
        blogThemes.setUpdateTime(DateUtils.getNowDate());
        return blogThemesMapper.updateBlogThemes(blogThemes);
    }

    /**
     * 批量删除博客主题
     *
     * @param themeIds 需要删除的博客主题主键
     * @return 结果
     */
    @Override
    public int deleteBlogThemesByThemeIds(Long[] themeIds)
    {
        return blogThemesMapper.deleteBlogThemesByThemeIds(themeIds);
    }

    /**
     * 删除博客主题信息
     *
     * @param themeId 博客主题主键
     * @return 结果
     */
    @Override
    public int deleteBlogThemesByThemeId(Long themeId)
    {
        return blogThemesMapper.deleteBlogThemesByThemeId(themeId);
    }

    @Override
    public List<ThemesVo> selectPopularThemes() {
         return blogThemesMapper.selectPopularThemes();
    }
}
